﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls">
    <!--BEGIN CHECKBOX-->
    <ControlTemplate x:Key="ControlCheckBox" TargetType="{x:Type Controls:SinacorCheckBox}">
        <BulletDecorator SnapsToDevicePixels="true" Background="Transparent">
            <BulletDecorator.Bullet>
                <Grid>
                    <Border Height="20" Width="21" VerticalAlignment="Center">
                        <Border x:Name="Border" BorderBrush="{DynamicResource BrushCheckBoxBorder}" BorderThickness="1" Background="{DynamicResource BrushCheckBoxBackground}" Width="13" Height="13" CornerRadius="2">
                            <Grid>
                                <Path x:Name="Path" Width="10.989" Height="10.997" Stretch="Fill" StrokeThickness="1.7" HorizontalAlignment="Right" VerticalAlignment="Bottom" Data="{DynamicResource IconCheckBoxFillHover}" Stroke="{DynamicResource BrushCheckBoxBackgroundHover}" Visibility="Collapsed"/>
                                <Rectangle x:Name="IndeterminateHover" StrokeThickness="0" Height="13" VerticalAlignment="Bottom" RadiusX="2" RadiusY="2" Width="13" HorizontalAlignment="Right" Visibility="Collapsed" Fill="{DynamicResource BrushCheckBoxIndeterminateHover}"/>
                                <Rectangle x:Name="Indeterminate" HorizontalAlignment="Left" Margin="2" VerticalAlignment="Bottom" Width="6.696" Height="6.695" Stroke="{x:Null}" Fill="{DynamicResource BrushCheckoxIndeterminate}" RadiusX="2" RadiusY="2"/>
                                <Path x:Name="CheckMark" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="7.3" Height="7" Margin="1.875,2,0,0" Data="{DynamicResource IconCheckBoxChecked}" Fill="{DynamicResource BrushCheckBoxCheckMarkFill}"/>
                            </Grid>
                        </Border>
                    </Border>
                    <Rectangle x:Name="RectangleBullet" Stroke="{DynamicResource BrushCheckBoxBorderFocused}" StrokeDashArray="2 2" StrokeThickness="1" SnapsToDevicePixels="true" Height="17" Width="17" VerticalAlignment="Center" Visibility="Collapsed"/>
                </Grid>
            </BulletDecorator.Bullet>
            <Grid Height="20">
                <Rectangle x:Name="RectangleContent" Stroke="{DynamicResource BrushCheckBoxBorderFocused}" StrokeDashArray="2 2" StrokeThickness="1" Margin="2" SnapsToDevicePixels="true" Height="15" VerticalAlignment="Center" Visibility="Collapsed"/>
                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="5,-0.7,0,0" VerticalAlignment="Center" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True" TextElement.Foreground="{TemplateBinding Foreground}" Style="{DynamicResource ControlFont}" />
            </Grid>
        </BulletDecorator>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsMouseCaptured" Value="False"/>
                    <Condition Property="IsChecked" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible" TargetName="Path"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsMouseCaptured" Value="False"/>
                    <Condition Property="IsChecked" Value="False"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible" TargetName="Path"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsMouseCaptured" Value="False"/>
                    <Condition Property="IsChecked" Value="{x:Null}"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible" TargetName="IndeterminateHover"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsFocused" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible" TargetName="RectangleContent"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsFocused" Value="True"/>
                    <Condition Property="Content" Value=""/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Collapsed" TargetName="RectangleContent"/>
                <Setter Property="Visibility" Value="Visible" TargetName="RectangleBullet"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsFocused" Value="True"/>
                    <Condition Property="Content" Value="{x:Null}"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Collapsed" TargetName="RectangleContent"/>
                <Setter Property="Visibility" Value="Visible" TargetName="RectangleBullet"/>
            </MultiTrigger>

            <Trigger Property="IsMouseCaptured" Value="True">
                <Setter Property="Background" Value="{DynamicResource BrushCheckBoxBackgroundPressed}" TargetName="Border"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="False">
                <Setter Property="Visibility" Value="Collapsed" TargetName="CheckMark"/>
                <Setter Property="Visibility" Value="Collapsed" TargetName="Indeterminate"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Visibility" Value="Collapsed" TargetName="Indeterminate"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="{x:Null}">
                <Setter Property="Visibility" Value="Collapsed" TargetName="CheckMark"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource BrushCheckBoxForegroundDisabled}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource BrushCheckBoxBorderDisabled}" TargetName="Border"/>
                <Setter Property="Background" Value="{DynamicResource BrushCheckBoxBackgroundDisabled}" TargetName="Border"/>
                <Setter Property="Fill" Value="{DynamicResource BrushCheckBoxCheckMarkFillDisabled}" TargetName="CheckMark"/>
                <Setter Property="Fill" Value="{DynamicResource BrushCheckBoxCheckMarkFillDisabled}" TargetName="Indeterminate"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    
    <Style TargetType="{x:Type Controls:SinacorCheckBox}">
        <Setter Property="Foreground" Value="{DynamicResource BrushCheckBoxForeground}"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Height" Value="21"/>
        <Setter Property="Width" Value="100" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="Template" Value="{DynamicResource ControlCheckBox}"/>
    </Style>
    <!--END CHECKBOX-->
    
    <Style x:Key="ControlCheckBoxDarkBackground" TargetType="{x:Type Controls:SinacorCheckBox}" BasedOn="{StaticResource {x:Type Controls:SinacorCheckBox}}">
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="Foreground" Value="{DynamicResource BrushCheckboxForeground}"/>
    </Style>

    <!--**************************************************************************************
    Estilos dos controles do SinacorDataGrid 
    **************************************************************************************-->
    <Style x:Key="ControlDataGridSinacorCheckBox" TargetType="{x:Type Controls:SinacorCheckBox}" BasedOn="{StaticResource {x:Type Controls:SinacorCheckBox}}">
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="HorizontalAlignment" Value="Center" />
    </Style>
</ResourceDictionary>